package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        /*
        简易倒计时程序
        程序开始后输入一个数字，从该数字开始每秒递减
         */
        System.out.println("程序开始了");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字:");
        for (int num = sc.nextInt(); num > 0; num--) {
            System.out.println(num);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("程序结束了");
        }
    }
}